package com.cqjtu.controller;

import com.cqjtu.pojo.AttendanceListDto;
import com.cqjtu.pojo.AttendanceTeamWorkerDto;
import com.cqjtu.pojo.AttendanceWorkerTimeDto;
import com.cqjtu.pojo.Result;
import com.cqjtu.service.IAttendanceService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class AttendanceController extends BaseController{

    @Resource
    private IAttendanceService attendanceService;

    @RequestMapping("/attendance_teams/worker_time")
    public Result getWorkerTimes(AttendanceWorkerTimeDto attendanceWorkerTimeDto) {
        return Result.success(attendanceService.getWorkerTimes(attendanceWorkerTimeDto));
    }

    @RequestMapping("/attendance_team_worker")
    public Result getTeamWorker(AttendanceTeamWorkerDto attendanceTeamWorkerDto) {
        return Result.success(attendanceService.getTeamWorker(attendanceTeamWorkerDto));
    }


    @RequestMapping("/attendance")
    public Result getAttendanceList(AttendanceListDto attendanceListDto) {
        return Result.success(getDataTable(attendanceService.getAttendanceList(attendanceListDto)));
    }

    @RequestMapping("/state")
    public Result getAttendanceState(@RequestParam("attendanceDate") String attendanceDate) {
        return Result.success(attendanceService.getAttendanceState(attendanceDate));
    }
}
